(function($,root){
	function Control(len){
		//this --> Control
		this.index = 0;
		this.len = len
	}
	Control.prototype = {
		prev:function() {
			/*if(this.index === 0) {
				this.index = len - 1;
			} else{
				this.index --;
			}
			return this.index*/

			return this.getIndex(-1)
		},
		next:function(){
			/*if(this.index === len - 1) {
				this.index = 0
			} else {
				this.index ++;
			}
			return this.index*/

			return this.getIndex(-1)
		},
		//计算改变后的索引
		getIndex:function(val) {
			//当前对应的索引
			var index = this.index;
			//数据总长度
			var len = this.len;
			return this.index = (index + val + len) % len;
		}
	}

	root.controlIndex = Control;

})(window.Zepto,window.player || (window.player = {}))